﻿using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

namespace Tetris2020.Scripts.UI
{
    public class MenuCanvasController : MonoBehaviour
    {
        [Tooltip("版本内容. 显示当前的游戏版本. 示例：Ver 1.0.0")] [SerializeField]
        public Text txtVersion;

        [Tooltip("开发者信息面板. 显示开发人员相关的信息.")] [SerializeField]
        public GameObject authorInfoPanel;

        /// <summary>
        /// 版本内容. 当前的游戏版本
        /// </summary>
        private string _mVersion;

        public string Version
        {
            get { return _mVersion; }
            set
            {
                this._mVersion = value;
                this.txtVersion.text = value;
            }
        }

        /// <summary>
        /// 开始游戏
        /// </summary>
        public void OnGameStart()
        {
            SceneManager.LoadScene("TetrisGame");
        }

        private void Start()
        {
        }

        private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                this.OnHideAuthorInfoPanel();
            }
        }

        public void OnShowAuthorInfoPanel()
        {
            this.authorInfoPanel.SetActive(true);
        }

        public void OnHideAuthorInfoPanel()
        {
            this.authorInfoPanel.SetActive(false);
        }
    }
}